Skip to content

Add dashboard connector for local browser imports - #227

Open
IlyaasK wants to merge 5 commits into
browser-import/02-managed-authfrom
browser-import/03-connector
Open

Add dashboard connector for local browser imports#227
IlyaasK wants to merge 5 commits into
browser-import/02-managed-authfrom
browser-import/03-connector

Conversation

@IlyaasK

@IlyaasK IlyaasK commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What

Add the macOS bridge that lets the Kernel dashboard open the existing local browser-import wizard with a kernel://browser-import?project_id=... link.

  • adds kernel connector install to register a user-level Kernel Connector.app
  • adds the hidden kernel connector open deep-link entrypoint
  • validates the link and confirms the authenticated user can access the requested active project
  • reuses profiles import-local; no second importer or downloaded helper is introduced
  • installs the connector best-effort from the Homebrew formula on macOS

Why

The previous dashboard handoff asked users to copy several terminal commands and manually carry a project ID. The connector turns that into one dashboard button while keeping sensitive browser and password-manager access inside the local CLI and its explicit terminal confirmations.

How

The dashboard supplies only a non-secret project ID. The CLI remains responsible for authentication, authorization, browser discovery, cookie selection, password-manager approval, profile import, and Managed Auth provisioning.

The installed app is a tiny AppleScript URL handler that delegates to the stable Kernel CLI path through a login shell. Installation is user-scoped, verifies exact bundle ownership before replacement, signs the completed app, preserves the previous app if rollback fails, and registers it with Launch Services. No server-side intent or new API is required.

This is intentionally macOS-only for the MVP. Windows and Linux return an explicit unsupported-platform error until their protocol-handler packaging is implemented.

Safety

  • accepts only the exact kernel://browser-import route with one validated project ID
  • authenticates locally and checks project access before import
  • refuses to replace an app not owned by Kernel
  • shell-quotes the executable and incoming URL
  • keeps password-manager sessions process-local
  • uses a unique BSD-compatible temporary launcher path and removes it on start

Verification

  • go test ./internal/connector ./internal/browserimport ./internal/passwordmanager ./internal/agentskills ./pkg/auth ./pkg/interactive ./cmd
  • go vet ./internal/connector ./internal/browserimport ./internal/passwordmanager ./internal/agentskills ./pkg/auth ./pkg/interactive ./cmd
  • Darwin smoke test compiles the emitted AppleScript with the real /usr/bin/osacompile
  • real local connector installation completed and /usr/bin/codesign --verify --strict passed
  • focused tests cover deep-link parsing, project authorization, authentication recovery, app ownership, rollback, and launcher generation

Stack

Depends on #224, which depends on #223.


Note

High Risk
Registers a macOS protocol handler (AppleScript + Launch Services) and changes authentication recovery, cookie export, and password-manager/Managed Auth provisioning. Bugs here can affect local credential handling, project access, or OS-level URL dispatch.

Overview
Lets the Kernel dashboard launch local browser import via a kernel://browser-import?project_id=... link, instead of copying CLI commands.

Adds kernel connector install (Homebrew post-install on macOS) which registers a user-scoped Kernel Connector.app URL handler that delegates to the stable CLI binary. Hidden connector open parses a tightly validated deep link, authenticates on demand, checks the project is active, and reuses profiles import-local. Wrong-account or invalid-API-key cases can recover with a prompted browser login (process-local KERNEL_API_KEY unset only).

Local import no longer caps at 5–10 recent sites: users can import all cookies or pick sites, and Managed Auth is quota-aware (org max_auth_connections), skips existing connections, and chooses logins per website. Cookie export can filter large site lists via a SQLite CTE; Bitwarden candidate lookup is bounded and concurrent. Auth now distinguishes missing credentials from storage/refresh failures so the connector can prompt login without hiding real errors.

Reviewed by Cursor Bugbot for commit 91296d1. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread internal/connector/connector.go Outdated
@kernel-internal

kernel-internal Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🔧 CI Fix Available

I've pushed a fix for the CI failure.

TestWebBotAuthDownloadable in pkg/extensions failed with context deadline exceeded while fetching the web-bot-auth archive from github.com. The test is unrelated to the changes in this PR: it downloads a real archive over the network but allowed only 30s for the request, while the production code allows 5 minutes for the same download. It failed on two attempts of the run and then passed on a third with no code change, so the branch is currently green by luck rather than because the flake is gone.

The request is now retried a few times, and both download tests in that file skip instead of fail when github.com cannot be reached. A non-200 response or a genuine extraction bug still fails the test, and the per-attempt timeouts stay well inside Go's default 10 minute package timeout so a stalled download ends in a skip rather than a panic.

👉 Click here to create a PR with the fix

Comment thread cmd/browser_import_managed_auth.go
Comment thread internal/passwordmanager/bitwarden.go
@IlyaasK
IlyaasK force-pushed the browser-import/03-connector branch from c590d01 to 3bc8e01 Compare August 20, 2026 19:38

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3bc8e01. Configure here.

Comment thread cmd/profiles_import_local.go
@IlyaasK
IlyaasK force-pushed the browser-import/03-connector branch from 3bc8e01 to 91296d1 Compare August 20, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant